#!/bin/bash
echo "此脚本针对python3环境安装在全局的 macOS卡特琳娜以上 适用"
echo "如果python3环境安装在虚拟环境，请自行编辑脚本代码，在脚本顶端添加虚拟环境的激活代码即可"
echo " "
echo "开始pip3安装相关依赖包，本次安装使用阿里云镜像，视网络情况不同，将耗费一定时间，请您耐心等候"
echo "三秒后安装开始"
echo " "
sleep 3s
pip3 install datetime -i http://mirrors.aliyun.com/pypi/simple/
pip3 install matplotlib -i http://mirrors.aliyun.com/pypi/simple/
pip3 install mplfinance -i http://mirrors.aliyun.com/pypi/simple/
pip3 install pandas -i http://mirrors.aliyun.com/pypi/simple/
pip3 install tushare -i http://mirrors.aliyun.com/pypi/simple/
pip3 install jupyter -i http://mirrors.aliyun.com/pypi/simple/

declare username
declare goalPath
username=$(ls /Users | tail -n 1)
echo "检测到用户账户名为 $username"
goalPath="/Users/$username/Desktop"
echo "请检查用户名是否正确"
echo "如若异常，请联系开发者 十七散人:QQ:1052886775"
read -p "若用户名正确无误，请按回车键继续"
echo "代码文件夹将创建在 $goalPath/股票预测走势绘制"
echo " "
sleep 1s
cd $goalPath
git clone --depth=1 https://gitee.com/SevDaisy/stock_forecast_trend.git
mv stock_forecast_trend 股票预测走势绘制
echo "alias yuce='python3 ~/Desktop/股票预测走势绘制/main.py'" >>"/Users/$username/.zshrc"
echo "代码安装完成"
echo " "
echo "为了使更改的配置生效，需要您运行 source /Users/$username/.zshrc 或者 打开一个新的终端窗口"
echo "在配置生效以后，请尝试运行命令 yuce 来启动程序"
open $goalPath/股票预测走势绘制/教程.html
